/*
 * Copyright (c) 2013 WDCY Information Technology Co. Ltd
 * www.wdcy.cc
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * WDCY Information Technology Co. Ltd ("Confidential Information").
 * You shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement you
 * entered into with WDCY Information Technology Co. Ltd.
 */
package com.monkey.core.domain.auth;

import com.monkey.core.domain.BaseEntity;
import com.monkey.core.domain.permission.Permission;
import com.monkey.core.domain.resource.Menu;
import com.monkey.core.domain.user.User;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

/**
 * @author Wu Tianqiang
 */
@Entity
@Table(name = "sys_user_resource_permission")
@DynamicUpdate
@DynamicInsert
public class UserResourcePermission extends BaseEntity<Long> {

    @ManyToOne
    @JoinColumn(name = "user_id")
    private User user;

    @ManyToOne
    @JoinColumn(name = "resource_id")
    private Menu menu;

    @ManyToOne
    @JoinColumn(name = "permission_id")
    private Permission permission;

    @Transient
    private String actualIdentity;

    public UserResourcePermission() {
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Menu getMenu() {
        return menu;
    }

    public void setMenu(Menu menu) {
        this.menu = menu;
    }

    public Permission getPermission() {
        return permission;
    }

    public void setPermission(Permission permission) {
        this.permission = permission;
    }

    public String getActualIdentity() {
        return actualIdentity;
    }

    public void setActualIdentity(String actualIdentity) {
        this.actualIdentity = actualIdentity;
    }
}